package oj;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Day21F{
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        while (sc.hasNext()) {
            int n = sc.nextInt();//需要洗几副牌
            for (int m = 0; m < n; m++) {
                int n1 = sc.nextInt();//需要洗的牌数的2/1
                int n2 = sc.nextInt();//需要洗几次
                int[] arr = new int[2 * n1];
                for (int i = 0; i < arr.length; i++) {
                    arr[i] = sc.nextInt();
                }
                while (n2 != 0) {
                    List<Integer> list = new ArrayList<>();
                    for (int i = 0; i < n1; i++) {
                        list.add(arr[i]);
                        list.add(arr[i+n1]);
                    }
                    for (int k = 0; k < 2 * n1; k++) {
                        arr[k] = list.get(k);
                    }
                    n2--;
                }
                for (int k = 0; k < 2 * n1 - 1; k++) {
                    System.out.print(arr[k] + " ");
                }
                System.out.println(arr[2 * n1 - 1]);
            }
        }
    }
}

